package com.niodata.dp.core.usermgr.op.impl;

import com.niodata.dp.core.usermgr.dao.TokenInfoMapper;
import com.niodata.dp.core.usermgr.model.TokenInfo;
import com.niodata.dp.core.usermgr.op.TokenInfoService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("tokenInfoServiceImpl")
public class TokenInfoServiceImpl implements TokenInfoService {

  @Autowired
  private TokenInfoMapper tokenInfoMapper;

  @Override
  public void createToken(TokenInfo tokenInfo) {
    tokenInfoMapper.insert(tokenInfo);
  }

  @Override
  public void deleteToken(String tokenId) {
    tokenInfoMapper.delete(tokenId);
  }

  @Override
  public void updateToken(TokenInfo tokenInfo) {
    tokenInfoMapper.updateToken(tokenInfo);
  }

  @Override
  public TokenInfo getToken(String tokenId) {
    return tokenInfoMapper.getByTokenId(tokenId);
  }

  @Override
  public List<TokenInfo> getUserTokenList(Long userId) {
    return tokenInfoMapper.getUserTokenList(userId);
  }
}
